package com.gw.smscheck.service.business.alarm.impl;

import java.util.List;

import com.gw.smscheck.entity.business.focuscrowd.FocusCrowd;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gw.smscheck.dao.business.alarm.AlarmInfoMapper;
import com.gw.smscheck.entity.business.alarm.AlarmInfo;
import com.gw.smscheck.service.business.alarm.AlarmInfoService;
@Service
public class AlarmInfoServiceImpl implements AlarmInfoService {
	@Autowired
	private AlarmInfoMapper alarmInfoMapper;

	/**
	 * 添加告警业务
	 * @param alarmInfo
	 * @return
	 */
	@Override
	public Integer add(AlarmInfo alarmInfo) {
		return alarmInfoMapper.add(alarmInfo);
	}
	@Override
	public List<AlarmInfo> findAll() {
		return alarmInfoMapper.findAll();
	}
	@Override
	public PageInfo<AlarmInfo> pageSelect(AlarmInfo dto) {
		PageHelper.startPage(dto.getPage(), dto.getRows(), "create_time desc");// 排序
		List<AlarmInfo> resultList = alarmInfoMapper.pageSelect(dto);
		PageInfo<AlarmInfo> pageInfo = new PageInfo<>(resultList);
		return pageInfo;
	}
	@Override
	public AlarmInfo findById(Integer dto) {
		return alarmInfoMapper.findById(dto);
	}
	@Override
	public Integer update(AlarmInfo alarmInfo) {
		return alarmInfoMapper.update(alarmInfo);
	}
	@Override
	public Integer delByIds(String[] ids) {
		return alarmInfoMapper.delByIds(ids);
	}

	/**
	 * 根据重点人手机号查询
	 * @param phoneNum
	 * @return
	 */
	@Override
	public List<AlarmInfo> findByFocusPh(String phoneNum) {
		return alarmInfoMapper.findByFocusPh(phoneNum);
	}

	/**
	 * 根据重点人id和类型查询告警业务是否存在
	 * @param alarmInfo
	 * @return
	 */
	@Override
	public List<AlarmInfo> findByFocusIdAndType(AlarmInfo alarmInfo) {
		return alarmInfoMapper.findByFocusIdAndType(alarmInfo);
	}

	/**
	 * 根据重点人id和类型删除
	 * @param alarmInfo
	 * @return
	 */
	@Override
	public Integer delByFocusIdAndType(AlarmInfo alarmInfo) {
		return alarmInfoMapper.delByFocusIdAndType(alarmInfo);
	}


}

